# -*- coding: utf-8 -*-

import time
import json
import scrapy
import string
import random

class DySpider(scrapy.Spider):
    name = 'dy_dtl'
    allowed_domains = ['dayu.com']
    # start_urls = ["https://ff.dayu.com/contents/author/15c5331f6d3d4635bfecb109492e77ca?biz_id=1002&_size=8&_page=2&_order_type=published_at&status=1&_fetch=1&uc_param_str=frdnsnpfvecpntnwprdssskt&_=1564411287776"]

    custom_settings = {
        'DEFAULT_REQUEST_HEADERS': {
            'authority': "mparticle.uc.cn",
            'cache-control': "max-age=0,no-cache",
            'upgrade-insecure-requests': "1",
            'user-agent': "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Mobile Safari/537.36",
            'dnt': "1",
            'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
            'accept-encoding': "gzip, deflate, br",
            'accept-language': "zh-CN,zh;q=0.9,en;q=0.8",
            # 'cookie': "cna=ClWgFSM8r1ACAQFVz10BE+19; _UP_A4A_11_=wb77311428314d14b4f7dd0798b38301; isg=BJeXuFDmhtT8UQJYdil2sATHJgshdFlaVUOoKenE6WbNGLda8akYjlU5fvij8EO2; _UP_28A_52_=201; _UP_D_=pc; vpstoken=WtGW43siDv2qbTGLh8qWLQ%3D%3D; hasLoadCommentEmojiData=1; _pk_ref.070b5f1f4053.1564=%5B%22%22%2C%22%22%2C1565074263%2C%22https%3A%2F%2Fmp.dayu.com%2Fdashboard%2Fcontents%3Fspm%3Da2s0i.db_stat_article.menu.6.2d743caavKVHlh%22%5D; _pk_id.070b5f1f4053.1564=2d795587-3a06-4bce-9473-66e5eacb3aa3.1564821539.3.1565074263.1564990877.; _pk_ses.070b5f1f4053.1564=*,cna=ClWgFSM8r1ACAQFVz10BE+19; _UP_A4A_11_=wb77311428314d14b4f7dd0798b38301; isg=BJeXuFDmhtT8UQJYdil2sATHJgshdFlaVUOoKenE6WbNGLda8akYjlU5fvij8EO2; _UP_28A_52_=201; _UP_D_=pc; vpstoken=WtGW43siDv2qbTGLh8qWLQ%3D%3D; hasLoadCommentEmojiData=1; _pk_ref.070b5f1f4053.1564=%5B%22%22%2C%22%22%2C1565074263%2C%22https%3A%2F%2Fmp.dayu.com%2Fdashboard%2Fcontents%3Fspm%3Da2s0i.db_stat_article.menu.6.2d743caavKVHlh%22%5D; _pk_id.070b5f1f4053.1564=2d795587-3a06-4bce-9473-66e5eacb3aa3.1564821539.3.1565074263.1564990877.; _pk_ses.070b5f1f4053.1564=*; vpstoken=Q3dSB4JT4Avr65tS9iExNQ%3D%3D",
            'Host': "mparticle.uc.cn",
            'Connection': "keep-alive"
        }
    }

    def start_requests(self):
        for i in range(10000):
            url = 'https://mparticle.uc.cn/article.html?uc_param_str=frdnsnpfvecpntnwprdssskt&wm_aid=1dac32a3b59944df9d125abf7fb3b6cb&i=%s'% (str(i))
            yield scrapy.Request(url)


    def parse(self, response):
        data = response.text
        self.log(data)
